﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Excell_On_Services.ViewModels.OrdersDisplayModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	HistoryOrders
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="content" >
	<div class="content_bg" >
        <div class="content_bg_bott" style="min-height: 400px;">
            <h1>HistoryOrders</h1>
            <table cellpadding=10" width="98%" class="view_history_order" border="0">

                <thead style="color:#333333; font-size: 15px;">
	                <tr>
		                <th >S.No</th>
                        <th >Client Name</th>
                        <th >Order Date</th>
                        <th >Total Money</th>
                        <th > Status</th>
                        <th></th>
	                </tr>	
                </thead>
                <tbody>
                    <% int i = 1; %>
                    <% 
                        foreach (var item in Model.Orders) {
                            var name_class = "";
                            if (i % 2 == 1) name_class = "att_row";
                    %>
                        <tr class="<%= name_class %>">
                            <td  style="font-weight: bold;"><%=i++ %></td>
                            <td >
                                <%: item.Client.CompanyName %>
                            </td>
                            <td >
                                <%: item.OrderDate %>
                            </td>
                            <td >
                                <%
                                    decimal totalMoney = 0;
                                    foreach (var detail in item.OrderDetails)
                                    {
                                        totalMoney += detail.Quantity * detail.Price * (long)((TimeSpan)(detail.EndDate - detail.StartDate)).TotalDays;
                                    } %>
                                    <% = totalMoney.ToString("c") %>
                            </td>
                            <td >                
                                <% if ((bool)item.Status)
                                    {%>
                                    <b>Approved</b>
                                <%}
                                    else
                                    { %>
                                    <b>Wait</b>
                                <% } %>
                            </td>
                            <td>
                                <%: Html.ActionLink("Details", "DetailsClient", new { orderId = item.OrderID })%>

                            </td>
                        </tr>
                    </tbody>
                <% } %>
            </table>
        </div>
    </div>
</div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent1" runat="server">
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="MainContent2" runat="server">
</asp:Content>
